﻿@using TomNet.IMSC.Model.DbModels.NewHouse;
@{
    Layout = null;
    var entity = ViewData["entity"] as Buildings;
}

<!DOCTYPE html>


<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link href="~/Content/Css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="~/Content/Css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="~/Content/Css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="~/Content/Css/animate.css" rel="stylesheet">
    <link href="~/Content/Css/style.css?v=4.1.0" rel="stylesheet">
    <title>Insert</title>
    <link href="/Content/Css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="~/Content/common.css" rel="stylesheet">
    <style> 
       /* .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 
        .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11 , .col-xs-12
        .form-control {
             border-style:solid; border-width:1px; border-color:#000;
        }*/
        #laberID {
            width:150px;
        }
        #Remark {
            width:920px;
        }
    </style>
</head>
<body>
    <div class="wrapper wrapper-content animated fadeInRight">
        <form class="form-horizontal m-t" id="mainForm">

            <input id="BuildingID" name="BuildingID" type="hidden" class="form-control" value="@entity.Id">

            <div class="row">
                <div class="col-sm-6"> 
                    <div class="form-group">
                        <label class="col-xs-3 control-label">楼盘名称：</label>
                        <div class="col-xs-9"> 
                            <input id="Building" name="Building" type="text" class="form-control" value="@entity.Name" readonly>
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请选择楼盘名称</span>
                        </div> 
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">户型面积：</label>
                        <div class="col-xs-9">
                            <input id="Area" name="Area" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写户型面积</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">户型室数：</label>
                        <div class="col-xs-9">
                            <input id="Room" name="Room" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写户型室数</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">户型厅数：</label>
                        <div class="col-xs-9">
                            <input id="Hall" name="Hall" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写户型厅数</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">户型卫数：</label>
                        <div class="col-xs-9">
                            <input id="Toilet" name="Toilet" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写户型卫数</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">户型库存：</label>
                        <div class="col-xs-9">
                            <input id="Inventory" name="Inventory" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写户型库存</span>
                        </div>
                    </div>
                   
                </div> 
                <div class="col-sm-6"> 
                    <div class="form-group">
                        <label class="col-xs-3 control-label">户型名称：</label>
                        <div class="col-xs-9">
                            <input id="Name" name="Name" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请填写户型名称</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">户型价格：</label>
                        <div class="col-xs-9">
                            <input id="Price" name="Price" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请输入户型价格</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">户型优惠：</label>
                        <div class="col-xs-9">
                            <input id="Preferential" name="Preferential" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请输入户型优惠</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">户型朝向：</label>
                        <div class="col-xs-9">
                            <input id="Orientations" name="Orientations" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请输入户型朝向</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">装修状况：</label>
                        <div class="col-xs-9">
                            <input id="DecorationCondition" name="DecorationCondition" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请输入装修状况</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-3 control-label">推荐理由：</label>
                        <div class="col-xs-9">
                            <input id="Reason" name="Reason" type="text" class="form-control">
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请输入推荐理由</span>
                        </div>
                    </div> 
                </div>
            </div> 
            <div class="row"> 
                    <div class="form-group">
                        <label class="col-xs-3 control-label" id="laberID">户型说明：</label>
                        <div class="col-xs-9" id="hxsmId">
                            <input id="Remark" name="Remark" type="text" class="form-control"> 
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>请输入户型说明</span>
                        </div>
                    </div> 
            </div> 
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group" style="margin-bottom:0px;padding-top:20px">
                        <div class="col-xs-3">

                        </div>
                        <div class="col-xs-9">
                            <button id="submit" class="btn btn-primary pull-right" type="submit">
                                <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                            </button>
                        </div>
                    </div>

                </div>
            </div>
        </form>
    </div>


    <!-- 全局js -->
    <script type="text/javascript" src="~/Scripts/jquery.min.js?v=2.1.4"></script>
    <script type="text/javascript" src="~/Scripts/bootstrap.min.js?v=3.3.6"></script>
    <!-- jQuery Validation plugin javascript-->
    <script type="text/javascript" src="~/Scripts/plugins/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="~/Scripts/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript" src="~/Scripts/Extensions/ExtValidator.js"></script>

    <!-- layer javascript -->
    <script type="text/javascript" src="~/Scripts/plugins/layer/layer.min.js"></script>
    <script src="/Scripts/plugins/iCheck/icheck.min.js"></script>

    <script type="text/javascript"> 
        $(function () { 
            var icon = "<i class='fa fa-times-circle'></i> ";
            var validator = $("#mainForm").validate({
                rules: {
                    BuildingID: { required: true, },
                    Name: { required: true, },
                    Area: { number: true, },
                    Room: { digits: true, },
                    Hall: { digits: true, },
                    Toilet: { digits: true, },
                    Inventory: { digits: true, },

                },
                messages: {
                    BuildingID: { required: icon + "请选择楼盘名称", },
                    Name: { required: icon + "请请输入户型名称", },
                    Area: { number: icon + "请输入合法数字", },
                    Room: { digits: icon + "请输入整数", },
                    Hall: { digits: icon + "请输入整数", },
                    Toilet: { digits: icon + "请输入整数", },
                    Inventory: { digits: icon + "请输入整数", },
                },
                submitHandler: function (form) {  
                    $.ajax({
                        url: "/NewHouse/HouseType/InsertAsync",
                        type: "post",
                        dataType: "json",
                        data: $('#mainForm').serialize(),
                        success: function (data) {
                            //Info,Success,Warning,Error
                            var type = data.type;
                            if (type == 1) {
                                layer.msg(data.content, { icon: 6, time: 2000 },
                                    function () {
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                    });

                            } else {
                                layer.msg(data.content, { icon: 5, time: 2000 });
                            }
                        }
                    });
                }
            });
        });

    </script>
</body>
</html>
